<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="css/layer.css"/>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/layer.js"></script>
    <script src="js/jq.cookie.js"></script>
</head>
<style>
    .password {
        width: 90%;
        margin-left: 5%;
    }

    .form-control {
        display: inline-block;
        width: 75%;
        display: inline-block;
    }

    .password label {
        width: 25%;
    }

    .password div {
        margin-top: 20px;
    }

    .submit {
        text-align: center;
    }

    button {
        width: 100px;
        height: 35px;
        background: #3c8dbc;
        color: white;
        margin-top: 20px;
    }
</style>
<body>
<div class="password">
    <div>
        <label>姓名：</label><input id="change-name" class="form-control " type="text" autocomplete="off"/>
    </div>
    <div>
        <label>手机号：</label><input id="change-no" class="form-control " type="text" autocomplete="off"/>
    </div>
    <!--<div>-->
    <!--<label>邮编</label><input class="form-control " type="text" autocomplete="off" />-->
    <!--</div>-->
    <div>
        <label>收货地址：</label><input id="change-ad" class="form-control " type="text" autocomplete="off"/>
    </div>
    <div class="submit">
        <button class="save_btn">提交</button>
    </div>
</div>


</body>
</html>
<script>
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

    var orderNum = GetQueryString('num');

    //初始化

    $.ajax({
        type: "get",
        url: "http://www.puer.zone:30000/OrdersReceiverInfo",
        async: true,
        data: {
            Id: orderNum
        },
        success: function (data) {

            for (var i = 0; i < data.length; i++) {
                $('input').eq(i).val(data[i]);
            }
        }
    });

    $('.save_btn').click(function () {
        $.ajax({
            type: "get",
            url: "http://www.puer.zone:30000/OrdersReceiverUpdate",
            async: true,
            data: {
                Id: orderNum,
                name: $('#change-name').val(),
                phone: $('#change-no').val(),
                // ZipCode:$('input').eq(2).val(),
                address: $('#change-ad').val(),
                // UserId:$.cookie('UserId')

            },
            success: function (data) {
                if (data == 'success') {
                    layer.msg('提交成功');
                    parent.location.reload();
                } else {
                    layer.msg('提交失败');
                }

            }
        });
    })
</script>